package com.blkj.modular.user.controller;

import com.blkj.common.annotation.HasPermission;
import com.blkj.common.core.bean.R;
import com.blkj.modular.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author 北浪 2021/11/19
 */
@Controller
@RequestMapping("/admin/user")
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/getUserById")
    @ResponseBody
    @HasPermission("admin")
    public R getUserById(){
        return R.ok().data(userService.getUserById(1));
    }

    @RequestMapping("/queryUser")
    @ResponseBody
    @HasPermission
    public R queryUser(){
        return R.ok();
    }

    @RequestMapping("/getAllUser")
    @ResponseBody
    public R getAllUser(){
        return R.ok().data(userService.list());
    }
}
